<div id="form"></div>
<script>
var frm=$("#form").ajajform({
	header: "<{>!{{mconfig.label}}<}>",
	footerButtons: [
		{value: "<{>!Create<}>",url: "<{>action<}>?mode=edit{{through}}"},
		{value: "<{>!Import<}>",url: "<{>action<}>?mode=import{{through}}"},
		{value: "<{>!Export<}>",url: "<{>action<}>?mode=export{{through}}"}
	]
});
var grid=frm.ajajform("insertWidget",null,null,{{JSON:grid}});
var items=<{>JSON:items<}>;
for (var i=0;i<items.length;i++) {
	var item=items[i];
	grid.ajajform_grid("insertRow",null,{rowClass: "item",cells:[{{foreach c in columns}}{{if fields.foreach_i}},{{/if}}{{c.out}}{{/foreach}}],id:item.id,level:item.level?item.level-1:undefined});
}
</script>

